
import cloud from '@lafjs/cloud'
import nw from "nw-lafjs";
import {fail, ok} from "@/utils/responseUtil";
const db = cloud.database()
const _ = db.command
export default async function (ctx: FunctionContext) {
  let body = ctx.body
  if (nw.util.isNull(body)||!nw.util.isArray(body)||body.length===0){
    return fail("参数不合法")
  }
  let count = await nw.db.update({
    dbName:"attrGroup",
    whereJson:{_id:_.in(body)},
    dataJson:{deleted:1}
  })
  if (count===0){
    return fail("删除失败")
  }
  return ok("删除成功")
}
